package gat.common.enums;

import java.util.ArrayList;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;

/**
 * @author sxq
 * @date 2022/1/11
 */

@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PaymentMethodEnum {

    ALIPAY("alipay", "支付宝"),
    WECHAT("wechat", "微信"),
    BANKCARD("bankCard", "银行卡"),
    ;

    private String code;
    private String desc;

    public static PaymentMethodEnum getByCode(String code) {
        for (PaymentMethodEnum payTypeEnum : values()) {
            if (String.valueOf(payTypeEnum.getCode()).equals(code)) {
                return payTypeEnum;
            }
        }
        return null;
    }

    public static List<PaymentMethodEnum> getList(){
        List<PaymentMethodEnum> list = new ArrayList<PaymentMethodEnum>();
        for(PaymentMethodEnum demo : PaymentMethodEnum.values()){
            list.add(demo);
        }
        return list;
    }

}
